//过滤图片
const imgDate = (img) => {
	var imgDate = 'http://zhiapi.2pe.cn' + img
	return imgDate
}
const formatDate = (time) => {
	if (!time) { 	//当时间是null或者无效格式时返回空
		return 'Không'
	} else {
		var date = new Date(time*1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
		var month = date.getMonth() + 1;
		if (month < 10)
			month = "0" + month;
		var hours = date.getHours();
		if (hours < 10)
			hours = "0" + hours;
		var minutes = date.getMinutes();
		if (minutes < 10)
			minutes = "0" + minutes;
			var seconds = date.getSeconds();
		if (seconds < 10)
			seconds = "0" + seconds;
		var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
			"  " + hours + ":" + minutes + ":" + seconds;
		return time;
		
		
	}
}
//过滤金额
const moneyDate = (money) => {
	if (!money) { 	
		return '0.00'
	} else {
		var mon = parseFloat(money)
		if(mon >= 10000){
			var price = parseFloat(mon/10000).toFixed(2);
			return price + '万';
		}else{
			return money;
		}
		
		
		
		
	}
}


//过滤金额
const moneyceshi = (money) => {
		money=(parseFloat(money)*100).toFixed(2)
		
		return money
}
//过滤金额
const toFixed0 = (money) => {
		money=parseFloat(money).toFixed(0)
		return money
}

//默认头像
const moimg = (img) => {
		if(img == undefined || img == 'undefined'  || img == '' ){
			img = '../../static/moren.png'
		}
		return img
}
//默认背景
const bgimg = (img) => {
		if(img == undefined || img == 'undefined'  || img == '' ){
			img = '../../static/morenbg.png'
		}
		return img
}

const jiequ = (time) => {
		time=time.split(" ")
		return time[0]
}
export {
	formatDate,moneyDate,moneyceshi,imgDate,toFixed0,moimg,bgimg,jiequ
}